package cn.zyjblogs.sms.common;

import cn.zyjblogs.sms.task.po.SmsTaskPO;
import cn.zyjblogs.sms.task.po.SmsTemplatePO;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class SmsRequest implements Serializable {
    /**
     * 方法
     */
    private String action;

    /**
     * 任务id
     */
    private String taskId;
    /**
     * 接受者手机号
     */
    private List<String> telNums;
    /**
     * 应用id 腾讯SmsSdkAppId
     */
    private String appId;

    /**
     * 发送账号安全认证的Access Key ID
     */
    private String accessKey;
    /**
     * 发送账号安全认证的Secret Access Key
     */
    //秘钥
    private String accessSecret;
    /**
     * 发送使用签名
     */
    private String signName;
    /**
     * 模板编码
     */
    private String templateCode;
    /**
     * SMS服务域名 百度/其他第三方需要
     */
    private String endPoint = null;

    /**
     * 短信参数
     * 腾讯是数组
     * 阿里百度 是json
     */
    private String templateParams;
    /**
     * 短信内容
     */
    private String smsContent;
    /**
     * 模板内容
     */
    private String templateContent;

    private String region;

    public SmsRequest(){

    }

    @Builder
    public SmsRequest(SmsTaskPO smsTaskPO, SmsTemplatePO smsTemplate,List<String> telNums) {
        this.templateParams = smsTaskPO.getTemplateParams();
        this.taskId = smsTaskPO.getId();
        this.appId = smsTemplate.getAppId();
        this.templateCode = smsTemplate.getTemplateCode();
        this.signName = smsTemplate.getSignName();
        this.accessKey = smsTemplate.getAccessKey();
        this.accessSecret = smsTemplate.getAccessSecret();
        this.telNums = telNums;
        this.region = smsTemplate.getRegion();
        this.smsContent = smsTaskPO.getContent();
    }
    @Builder
    public SmsRequest(String action, String taskId, List<String> telNums, String appId, String accessKey, String accessSecret, String signName, String templateCode, String endPoint, String templateParams, String smsContent, String templateContent, String region) {
        this.action = action;
        this.taskId = taskId;
        this.telNums = telNums;
        this.appId = appId;
        this.accessKey = accessKey;
        this.accessSecret = accessSecret;
        this.signName = signName;
        this.templateCode = templateCode;
        this.endPoint = endPoint;
        this.templateParams = templateParams;
        this.smsContent = smsContent;
        this.templateContent = templateContent;
        this.region = region;
    }
}
